package com.qfedu.common.core.config;

import com.qfedu.common.core.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyWebMvcConfigurer implements WebMvcConfigurer {

    // 注册拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 配置需要拦截的所有访问请求--拦截所有请求
        String[] addPathPatterns = {
                "/**"
        };

        // 注册拦截器
        registry.addInterceptor(new LoginInterceptor()).addPathPatterns(addPathPatterns);
        // registry.addInterceptor(new TimeInterceptor()).addPathPatterns(addPathPatterns);
        // WebMvcConfigurer.super.addInterceptors(registry);
    }
}
